package com.sima.crawler;

import com.sima.db.MysqlDBUtils;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.PageModelPipeline;
import us.codecraft.webmagic.pipeline.Pipeline;

/**
 * Created by cfq on 2017/4/30.
 */
public class GankDaoPipeline implements Pipeline {


    @Override
    public void process(ResultItems resultItems, Task task) {
        System.out.println("process");
        GankModel gankModel = new GankModel(resultItems.get("title").toString(), resultItems.get("content").toString());
        //可以存入数据库
//        System.out.println(gankModel.getTitle());
        System.out.println("插入" + MysqlDBUtils.insert(gankModel) + "条数据！");

    }
}
